var express = require('express');
var router = express.Router();

/* GET users listing. */
router.get('/', function(req, res, next) {
  res.send('respond with a resource');
});

router.post('/testSelectData.do',function (req,res) {
  if(req.is('application/*')){
      var result = [];
      for(var i=0;i<20;i++){
          result.push({sid:i,sname:'xie'+i})
      }

      res.header("Access-Control-Allow-Origin", "*");
      res.header('Access-Control-Allow-Methods', 'PUT, GET, POST, DELETE, OPTIONS');
      res.header("Access-Control-Allow-Headers", "X-Requested-With");
      res.header('Access-Control-Allow-Headers', 'Content-Type');
      res.json(result);
  }else{
      res.send("not json request")
  }
})

module.exports = router;
